package thread;

/**
 * Created with IntelliJ IDEA.
 * ClassName: Singleton
 * Package: thread
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-10-10
 * Time: 14:33
 */


//单例模式
public class Singleton {

    //饿汉模式 创建实例 直接初始化
    private static Singleton instance = new Singleton();
    //构造方法私有化
    private Singleton(){}

    //提供一个方法 外面能够拿到
    public static Singleton getInstance(){
        return instance;
    }
}
